<%@page import="cn.sendto.service.ResidentInfoService"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
	<jsp:include page="../lock.jsp"></jsp:include>
<%
	request.setCharacterEncoding("UTF-8");
	String id = request.getParameter("id");
	String username = request.getParameter("username");
	String userpass = request.getParameter("userpass");
	String name = request.getParameter("name");
	String gender = request.getParameter("gender");
	String age = request.getParameter("age");
	String tellphone = request.getParameter("tellphone");
	String idcard = request.getParameter("idcard");
	
	ArrayList<Integer> errlist = new ArrayList<Integer>();
	if(userpass == null || userpass.equals("")){
		errlist.add(2);
	}
	if(name == null || name.equals("")){
		errlist.add(5);
	}
	if(gender == null || gender.equals("")){
		errlist.add(6);
	}
	if(age == null || age.equals("")){
		errlist.add(7);
	}
	if(tellphone == null || tellphone.equals("")){
		errlist.add(8);
	}
	if(idcard == null || idcard.equals("")){
		errlist.add(9);
	}
	
	if(errlist.size() > 0){
		request.setAttribute("errinfo", errlist);
		request.getRequestDispatcher("modresident.jsp").forward(request, response);
		return;
	}
	ResidentInfoService ris = new ResidentInfoService();
	int i = ris.modRes(userpass,name,gender,age,tellphone,idcard,id);
	if(i > 0 ){
		request.setAttribute("residentinfo", "修改成功");
		request.getRequestDispatcher("residentlist.jsp").forward(request, response);
		return;
	}else{
		request.setAttribute("residentinfo", "修改失败");
		request.getRequestDispatcher("residentlist.jsp").forward(request, response);
		return;
	}

%>